<?php

namespace App\Http\Requests\Admin\Panx\Product;

use App\Http\Requests\ApiRequest;
use Illuminate\Foundation\Http\FormRequest;

/**
 * @property string name
 * @property string const
 */
class ProductTagStoreRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'  => 'required|string|unique:product_tags,name|max:'.self::MAX_STRING,
            'const' => 'required|regex:/^[0-9a-zA-Z-_\s]+$/|unique:product_tags,const|max:'.self::MAX_STRING
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'name.*' => '商品标签名必须是唯一的字符串',
//        ];
//    }
}
